#ifndef TERRAIN_RENDERER_H
#define TERRAIN_RENDERER_H

#include <vector>
#include "../util/NTuple.h"
#include "../geom/TerrainModel.h"

namespace glutil
{
	/** Renders a terrain given by a 3D model */
	class TerrainRenderer
	{
		protected:
			/** Terrain shape */
			const geom::TerrainModel * m_model;
			/** Updates the VBOs to store the current shape data */
			void generateVertexBufferObjects();
			/** Number of points in the mesh */
			size_t m_numPoints;
			/** Vertex VBO ID */
			unsigned int m_vbufferID;
                        /** Normals VBO ID */
                        unsigned int m_nbufferID;

			/** Index VBO ID */
			unsigned int m_ibufferID;
		public:
			/** Constructor
			  @param model Terrain model shape */
			TerrainRenderer(const geom::TerrainModel * model);
			/** Destructor */
			~TerrainRenderer();

			/** Renders the terrain in the 3D world */
			void render();
	};
}

#endif
